package manager{
	import br.com.stimuli.loading.BulkProgressEvent;
	
	import view.components.BaseAnimationCreatePanel;
	import view.components.CategoryOperator;
	import view.components.SDKOperator;
	
	public class PanelManager{
		
		protected static var baseAnimationCreatePanel:BaseAnimationCreatePanel;  
		protected static var categoryOperator:CategoryOperator;
		protected static var sdkOperator:SDKOperator;
		
		public static function showBaseAnimationCreatePanel():void{
			LoadManager.loader.add("assets/swf/panel/BaseAnimationCreatePanel.swf",{id:"panel"});
			LoadManager.loader.addEventListener(BulkProgressEvent.COMPLETE,onComplete);
			LoadManager.loader.start();
		}
		
		public static function showCategoryOperator():void{
			if(!categoryOperator){
				var clazz:Class = LoadManager.loader.get("panel").getDefinition("CategoryOperator");
				categoryOperator = new clazz() as CategoryOperator;
			}
			baseAnimationCreatePanel.switchDisplay(categoryOperator,baseAnimationCreatePanel.animationWindow);
		}
		
		public static function showSDKOperator():void{
			if(!sdkOperator){
				var clazz:Class = LoadManager.loader.get("panel").getDefinition("SDKOperator");
				sdkOperator = new clazz() as SDKOperator;
			}
			StageManger.addWindow(sdkOperator);
		}
		
		public static function showAnimationWindow():void{
			baseAnimationCreatePanel.switchDisplay(baseAnimationCreatePanel.animationWindow,categoryOperator);
		}
		
		protected static function onComplete(event:BulkProgressEvent):void{
			var clazz:Class = LoadManager.loader.get("panel").getDefinition("SimpleCreatePanel");
			baseAnimationCreatePanel = new clazz() as BaseAnimationCreatePanel;
			StageManger.addApp(baseAnimationCreatePanel);
			if(!ConfigManager.init)
				PanelManager.showSDKOperator();
		}
	}
}